{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="style"}
<link rel="stylesheet" href="{__STATIC__}/layui/plugin/dtree/dtree.css">
<link rel="stylesheet" href="{__STATIC__}/layui/plugin/dtree/font/dtreefont.css">
<link rel="stylesheet" href="{__STATIC__}/mdeditor/css/editormd.min.css?v=1.0.2">
<link rel="stylesheet" href="{__STATIC__}/mdeditor/css/editormd.preview.min.css?v=1.0.2">
<style>
.layui-unselect dl {max-height:188px;}
</style>
{/block}
{block name="breadcrumb"}
<span class="layui-breadcrumb">
  <a href="https://www.gougucms.com/" target="_blank">勾股DEV</a>
  <a><cite>任务中心</cite></a>
</span>
{/block}
{block name="body"}
<div class="table-content p-3">
	<div class="layui-form-bar border-t border-x">
		<button class="layui-btn layui-btn-sm layui-btn-normal add-new">+ 新建任务</button>
	</div>
	<table class="layui-hide" id="test" lay-filter="test"></table>
</div>

<script type="text/html" id="barDemo">
<div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</span></div>
</script>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script src="{__STATIC__}/mdeditor/editormd.min.js"></script>
<script>
function init(layui){
	var table = layui.table,form = layui.form,gougu = layui.gougu;
	
	layui.pageTable = table.render({
		elem: '#test',
		title: '任务列表',
		cellMinWidth:200,
		url: "/task/index/index", //数据接口
		page: true, //开启分页
		limit: 20,
		cols:  [[
			{field:'id', title: '任务编号',width: 80, align:'center',fixed:'left',templet:function(d){
				return 'T'+d.id;
			}}
			,{field:'flow_name',title: '状态',align:'center',width: 80,templet:function(d){
				var html = '<span class="layui-badge bg-flow-'+d.flow_status+'">'+d.flow_name+'</span>';
				return html;
			}}
			,{field:'cate_name',title: '类别',width: 100,align:'center'}
			,{field:'type_name',title: '类型',width: 60,align:'center',templet:function(d){
				var html = '<span class="color-status-'+d.type+'">'+d.type_name+'</span>';
				return html;
			}}
			,{field:'title',title: '任务主题'}
			,{field:'priority_name',title: '优先级',align:'center',width: 70,templet:function(d){
				var html = '<span class="layui-badge bg-priority-'+d.priority+'">'+d.priority_name+'</span>';			
				return html;
			}}
			,{field:'director_name',title: '负责人', align:'center',width: 90}
			,{field:'assist_admin_names',title: '协作人',width: 200}
			,{field:'plan_hours',title: '预估工时', align:'center',width: 80}				
			,{field:'end_time',title: '预计结束日期', align:'center',width: 120}				

			,{fixed: 'right',title: '操作',align: 'center',width: 60,toolbar: '#barDemo',}
		]]
	});
	
	//新增
	$('.add-new').on('click',function(){
		gougu.open('/task/index/add');
	});
	
	//监听行工具事件
	table.on('tool(test)', function(obj) {
		var data = obj.data;
		if (obj.event === 'view') {
			gougu.open('/task/index/view?id='+data.id);
			return;
		}
	});
}		
</script>
{include file="../../base/view/common/layui" base='base' extend="['gougu','employeepicker','gouguEdit','gouguComment','gouguSchedule']" callback="init" /}
{/block}
<!-- /脚本 -->